import { debounce } from '@/common/utils.js'

export const itemListenerMixin = {
  data() {
    return {
      itemImgListener: null
    }
  },
  mounted() {
    const refresh = debounce(this.$refs.scroll.refresh, 500)
    //监听图片加载完成
    this.itemImgListener = () => {
      refresh()
    }
    this.$bus.$on('itemImageLoad', this.itemImgListener)
    // console.log('混入的mounted函数打印内容');
  },
}

import BackTop from 'components/content/backTop/BackTop'

export const backTopMixin = {
  components: {
    BackTop
  },
  data() {
    return {
      isShowBackTop: false,
    }
  },
  methods: {

    /**
     *  backTop()
     *  回到顶部,监听自定义组件的原生事件 
     */
    backTop() {
      // console.log('原生事件');
      this.$refs.scroll.scrollTo(0, 0)
    },
  },
}